package com.zx.mes.longsecurity.hyl.service.impl;


import com.zx.mes.longsecurity.hyl.dao.ResourceTypeRepository;
import com.zx.mes.longsecurity.hyl.domain.Tresourcetype;
import com.zx.mes.longsecurity.hyl.pagemodel.ResourceType;
import com.zx.mes.longsecurity.hyl.service.ResourceTypeServiceI;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author hyl
 */
@Service
public class ResourceTypeServiceImpl implements ResourceTypeServiceI {


    @Autowired
    private ResourceTypeRepository resourceTypeRepository;

    @Override
    public List<ResourceType> getResourceTypeList() {

        List<ResourceType> resourceTypeList=new ArrayList<>();
        List<Tresourcetype> tresourcetypeList=resourceTypeRepository.findAll();

        for (Tresourcetype t:tresourcetypeList){
            ResourceType resourceType=new ResourceType();
            BeanUtils.copyProperties(t,resourceType);
            resourceTypeList.add(resourceType);
        }
        return resourceTypeList;
    }
}
